home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Tools / Dev / Meshwriter / meshwriter_private.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-03  |  4.7 KB  |  169 lines

  1. /*
  2. **      $VER: meshwriter_private.h 1.00 (27.03.1999)
  3. **
  4. **      Creation date     : 18.10.1998
  5. **
  6. **      Description       :
  7. **         Private type definitions and constants for the mesh writer module.
  8. **
  9. **      Written by Stephan Bielmann
  10. **
  11. **
  12. */
  13.  
  14. #ifndef INCLUDE_MESHWRITER_PRIVATE_H
  15. #define INCLUDE_MESHWRITER_PRIVATE_H
  16.  
  17. /********************************************************************/
  18.  
  19. #include <meshwriter_public.h>
  20.  
  21. /*********************** Defines and types **************************/
  22.  
  23. /*
  24. ** Hashsize definition
  25. */
  26. #define HASHSIZE 51
  27.  
  28. /*
  29. ** Bounding box structure
  30. */
  31. typedef struct {
  32.     TOCLFloat front,rear,left,right,top,bottom;
  33. }TOCLBBox;
  34.  
  35. /*
  36. ** Camera structure
  37. */
  38. typedef struct {
  39.     TOCLVertex    position,lookat;
  40. }TOCLCamera;
  41.  
  42. /*
  43. ** Light source structure
  44. */
  45. typedef struct {
  46.     TOCLVertex    position;
  47.     TOCLColor    color;
  48. }TOCLLight;
  49.  
  50. /*
  51. ** Vertex node structure
  52. */
  53. typedef struct TOCLVertexNode {
  54.     ULONG            index;        /* Index of this vertex, beginning at 1        */
  55.     TOCLVertex        vertex;    /* Vertex itself                                 */
  56.     TOCLVertexNode    *next;        /* Next vertex node                             */
  57. }TOCLVertexNode;
  58.  
  59. /*
  60. ** Vertex list structure
  61. */
  62. typedef struct {
  63.     ULONG            numberOfVertices;        /* Number of vertices in this list    */
  64.     TOCLVertexNode    *firstNode;            /* First vertex node in this list        */
  65.     TOCLVertexNode    *lastNode;                /* Last vertex node in this list        */
  66. } TOCLVertexList;
  67.  
  68. /*
  69. ** Material structure, the real material
  70. */
  71. typedef struct TOCLMaterialNode {
  72.     ULONG  index;                        /* Index of this material, beginning at 1    */
  73.     STRPTR name;                        /* The material its name                     */
  74.     
  75.     TOCLColor ambientColor;            /* The material its ambient color */
  76.     TOCLColor diffuseColor;            /* The material its diffuse color */
  77.     TOCLFloat shininess;                /* The material its shininess     */
  78.     TOCLFloat transparency;            /* The material its transparency  */
  79.     
  80.     TOCLMaterialNode *next;            /* Next material node             */
  81. }TOCLMaterialNode;
  82.  
  83. /*
  84. ** Material list structure
  85. */
  86. typedef struct {
  87.     ULONG                numberOfMaterials;    /* Number of materials in this list */
  88.     TOCLMaterialNode    *firstNode;        /* First material node in this list */
  89.     TOCLMaterialNode    *lastNode;            /* Last material node in this list  */
  90. }TOCLMaterialList;
  91.  
  92. /*
  93. ** Polygon its vertex list
  94. */
  95. typedef struct TOCLPolygonsVerticesNode {
  96.     TOCLVertexNode                *vertexNode;    /* Pointer to an existing vertex node    */
  97.     TOCLPolygonsVerticesNode    *next;            /* Next vertex node in this polygon     */
  98. } TOCLPolygonsVerticesNode;
  99.  
  100. /*
  101. ** Polygon node structure, the real polygon
  102. */
  103. typedef struct TOCLPolygonNode {
  104.     ULONG                        numberOfVertices;    /* Number of vertices in this polygon, should be >=3 */
  105.         
  106.     TOCLMaterialNode            *materialNode;        /* Pointer to an existing material node */
  107.         
  108.     TOCLPolygonsVerticesNode    *firstNode;        /* First vertex node in this polygon */
  109.     TOCLPolygonsVerticesNode    *lastNode;            /* Last vertex node in this polygon  */
  110.     
  111.     TOCLPolygonNode            *next;                /* Next polygon node                 */
  112. }TOCLPolygonNode;
  113.  
  114. /*
  115. ** Polygon list structure
  116. */
  117. typedef struct {
  118.     ULONG                numberOfPolygons;    /* Number of polygons in this list */
  119.     TOCLPolygonNode    *firstNode;        /* First polygon node in this list */
  120.     TOCLPolygonNode    *lastNode;            /* Last polygon node in this list  */
  121. }TOCLPolygonList;
  122.  
  123. /*
  124. ** Hash its vertex list
  125. */
  126. typedef struct TOCLHashsVerticesNode {
  127.     TOCLVertexNode            *vertexNode;    /* Pointer to an existing vertex node    */
  128.     TOCLHashsVerticesNode    *next;            /* Next vertex node in this hash        */
  129. } TOCLHashsVerticesNode;
  130.  
  131. /*
  132. ** Current Transformation Matrix
  133. */
  134. typedef struct {
  135.     TOCLFloat sx,sy,sz;    // Scale, 1 = as it is
  136.     TOCLFloat rx,ry,rz;    // Rotation in radian. 0 = no rotation. Needed to 
  137.                            // compute the ctm.m matrix.
  138.     TOCLFloat m[4][4];        // Matrix containing the rotation and transformation
  139. }TOCLCTM;
  140.  
  141. /*
  142. ** Mesh structure
  143. */
  144. typedef struct {
  145.     APTR    vertexpool;                /* Header of the vertex memory pool of this mesh */
  146.     APTR    polygonverticespool;        /* Header of the polygon vertex memory pool ot this mesh */
  147.     APTR    polygonpool;                /* Header of the polygon memory pool of this mesh */
  148.   
  149.     STRPTR  name;                       /* The name of this mesh */
  150.     
  151.     STRPTR  copyright;                    /* For the single lined copyright string */
  152.     
  153.     TOCLBBox    bBox;                    /* The bounding box    */
  154.     TOCLCamera camera;                    /* The camera            */
  155.     TOCLLight  light;                    /* The lightsource        */
  156.         
  157.     TOCLVertexList   vertices;          /* The list of vertices of this mesh  */
  158.     TOCLPolygonList  polygons;          /* The list of polygons of this mesh  */ 
  159.     TOCLMaterialList materials;        /* The list of materials of this mehs */
  160.  
  161.     TOCLCTM        ctm;                /* The current transformation marix of this mesh */
  162.  
  163.     TOCLHashsVerticesNode *hashTable[HASHSIZE]; /* Internal hashtable for the vertices */
  164. } TOCLMesh;
  165.  
  166. #endif
  167.  
  168. /************************* End of file ******************************/
  169.